package com.aiit.carinsurance2.controller;

import com.aiit.carinsurance2.pojo.Carinsurance;
import com.aiit.carinsurance2.service.InsuranceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class InsuranceController {

    @Autowired
    private InsuranceService insuranceService;

    @GetMapping("/insurance")
    public String getinsurance(Model model){
       List<Carinsurance> carinsurance =insuranceService.queryall();
       model.addAttribute("list",carinsurance);
       return "insurance";
    }
}
